<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once(dirname(__FILE__) . "/../dbcom/UserCom.php");

$usercom = new UserCom();

if (!isset($_SESSION['user_id']) || empty($_SESSION['user_id'])) {
    echo json_encode(array("code" => 100, "msg" => "error password"));
    exit();
}
$userid = $_SESSION['user_id'];
$user = $usercom->getUserById($userid);
$role = $user['role'];
$rolearr = explode(",", $role);
$rarr = array(0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6, 6 => 7, 7 => 8, 8 => 9);
$i = 0;
$arr = array();
if ($role != 0) {
    foreach ($rarr as $v) {
        if (in_array($v, $rolearr)) {
            
        } else {
            $arr[$i] = $v;
            $i++;
        }
    }
}
$result = array("code" => 0, "data" => implode(",", $arr));
echo json_encode($result);
